#!/bin/bash


PWD=$(dirname $(readlink -f "$0"))
PLUGINS_PATH=$PWD/plugins/python-build/share/python-build


require_gcc() {
    echo "gcc"  >/dev/null
}

install_package() {
  export package_type_nargs="$2"
}
has_tar_xz_support() {
  tar Jcf - /dev/null 1>/dev/null 2>&1
}
install_git() {
 echo "install_git" >/dev/null
}
prefer_openssl11() {
  echo "prefer_openssl11" >/dev/null
}
colorize() {
    echo "colorize" >/dev/null
}
for filename in `ls $PLUGINS_PATH`
do
    . $PLUGINS_PATH/$filename
    result=$(echo $package_type_nargs | grep "www.python.org/ftp" )
    if [ -n "$result" ]
    then
        re=$(curl  -s -I -o /dev/null -w %{http_code} $(echo $package_type_nargs| sed  's/www.python.org\/ftp/mirrors.huaweicloud.com/g') )
        if [ $re -eq 200 ]
        then
            sed  -i 's/www.python.org\/ftp/mirrors.huaweicloud.com/g'  $PLUGINS_PATH/$filename
        fi
    fi
done
